A Monadic Account of First-class Synchronous Events

نویسنده

  • Matthew Fluet
چکیده

These two quotations represent the key ideas behind two major research agendas. The first captures the essence of monadic I/O, which is the fundamental abstraction used to provide input/output and concurrency in the lazy, purely-functional language (Concurrent) Haskell. The second captures the essence of first-class synchronous events, which is the fundamental abstraction used to provide concurrency in the strict, mostly-functional language Concurrent ML. While there are many superficial connections between Concurrent Haskell and Concurrent ML, the striking parallels in these descriptions of their fundamental abstractions begs further investigation. The question that naturally arises is the following: “Does the event type constructor of Concurrent ML form a monad?” Having asked that question, we are immediately led to another, related question: “Since non-deterministic choice is an event combinator, does the event type constructor of Concurrent ML form a monad-with-plus?” Unfortunately, it is easy to demonstrate that the most natural means of defining the monad-with-plus operations in terms of CML event combinators fail to satisfy the necessary monad laws. In this work, we review the monad laws and the reasons that CML events do not naturally form a monad-with-plus. This investigation reveals that the essential missing component is an event combinator that combines a sequence of events into a single event and whose semantics ensure an “all-or-nothing” property – either all of the constituent events synchronize in sequence or none of them synchronize. We propose a new concurrency calculus that draws inspiration from both Concurrent ML and Concurrent Haskell. Like Concurrent ML, it includes first-class synchronous events and event combinators (including the new sequencing combinator), forming a monad-with-plus. Like Concurrent Haskell, it includes first-class I/O actions and I/O combinators, forming a monad. The essence of the dynamics is to embrace the interpretation of monad as a notion of computation. Hence, the two monads (Evt and IO), yield two sorts of computations. This is expressed by three levels of evaluation: sequential evaluation of pure terms, synchronous evaluation of synchronizing events (e.g., the Evt monad), and concurrent evaluation of concurrent threads (e.g., the IO monad). The bridge between the Evt and IO monads is synchronization, which moves events and threads from concurrent evaluation to synchronous evaluation and back to concurrent evaluation.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

On the Expressiveness of Monadic Higher Order Safe Ambient Calculus

In this paper, we propose a monadic higher order safe ambient calculus. The expressiveness of this calculus is studied. We showed that polyadic higher order safe ambient calculus, first order safe ambient calculus with capability-passing, first order safe ambient calculus with name-passing, and polyadic π-calculus can all be encoded in monadic higher order ambient calculus. At last, we show tha...

متن کامل

The Closure of Monadic NP

It is a well-known result of Fagin that the complexity class NP coincides with the class of problems expressible in existential second-order logic (Z i), which allows sentences consisting of a string of existential second-order quantifiers followed by a first-order formula. Monadic NP is the class of problems expressible in monadic Z ; , i.e., Z ; with the restriction that the second-order quan...

متن کامل

The Regular Real-Time Languages

A speciication formalism for reactive systems deenes a class of !-languages. We call a speciication formalism fully decidable if it is constructively closed under boolean operations and has a decidable satissability (nonemptiness) problem. There are two important, robust classes of !-languages that are deenable by fully decidable formalisms. The !-regular languages are deenable by nite automata...

متن کامل

Independence-friendly cylindric set algebras

Independence-friendly logic is a conservative extension of first-order logic that has the same expressive power as existential second-order logic. In her Ph.D. thesis, Dechesne introduces a variant of independence-friendly logic called IFG logic. We attempt to algebraize IFG logic in the same way that Boolean algebra is the algebra of propositional logic and cylindric algebra is the algebra of ...

متن کامل

Overview of the Monadic Constraint Programming Framework

A constraint programming system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about satisfiability of conjunctions of constraints, and the search engine controls the search for solutions by iteratively exploring a disjunctive search tree defined by the constraint program. The Monadic Constraint Programming framework gives a monadic def...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006